/ Assembly List / LJCNetCommon / LJCCryptography / Decrypt

Namespace - LJCNetCommon


Parameters
cipher - The cipher byte array.
key - The encryption key.
initializationVector - The IV value.

Returns

The decrypted text value.

Syntax

C#
public String Decrypt(Byte[] cipher, Byte[] key, Byte[] initializationVector)

Returns a decrypted string from a cipher byte array. (E)

Example

C#
MemoryCrypto crypto = new MemoryCrypto();
string text = null;
byte[] key = {230, 191, 149, 1, 207, 136, 112, 200
               , 7, 192, 109, 130, 188, 192, 27, 183
               , 238, 1, 248, 74, 35, 47, 1, 144
               , 90, 91, 5, 167, 87, 170, 11, 141};
byte[] iv = {94, 9, 42, 5, 218, 86, 120, 94
             , 209, 208, 216, 111, 24, 4, 255, 67};
byte[] cipher;
        
// Retrieve value.
text = GetEncryptedValue();
        
// Convert from Base64 and decrypt to text.
cipher = Convert.FromBase64String(text);
crypto.CryptoType = Crypto_Type.Crypto_Rijndael;
text = crypto.Decrypt(cipher, key, iv);

Copyright © Lester J. Clark and Contributors.
Licensed under the MIT License.